<?php
require('common_view_functions.php');

function shorter($ct) {
	if(mb_strlen($ct, 'UTF-8') > 48) { // comment preview length
		return mb_substr($ct, 0, 48, 'UTF-8') . '...';
	} else {
		return $ct;
	}
}

if($list_type == 0) {
	// unauthed comments
	foreach($comments as $c) {
?>
<dt><input type="checkbox" id="uc_<?php echo($c->id); ?>" value="<?php echo($c->id); ?>" /> <?php echo(htmlspec($c->author_name)); ?> @ <?php echo($c->post_time); ?> 评论：<a target="_blank" href="<?php echo('/' . $blogger_uri . '/entry/' . $c->entry_id); ?>"><?php echo(htmlspec($c->title)); ?></a></dt>
<dd><?php echo(htmlspec(shorter($c->content))); ?></dd>
<dd class="cinfo">IP: <?php echo($c->ip); ?></dd>
<?php
	}
} elseif($list_type == 1) {
	foreach($comments as $c) {
?>
<dd><?php echo(htmlspec($c->author_name)); ?>：<a target="_blank" href="<?php echo('/' . $blogger_uri . '/entry/' . $c->entry_id . '#c' . $c->id); ?>"><?php echo(htmlspec(shorter($c->content))); ?></a></dd>
<?php
	}
}
?>
